package cn.train.service;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import cn.train.dao.IOrderTableDao;
import cn.train.model.Ordertable;
import cn.train.util.SqlSessionFactoryUtil;

public class OrderTableService {

	SqlSession session = SqlSessionFactoryUtil.getSqlSession();
	IOrderTableDao orderTableDao = session.getMapper(IOrderTableDao.class);

	public int getCount() {
		return orderTableDao.getCount();
	}

	public List<Ordertable> getOrdertableByPage(int pageIndex, int pageSize) {
		pageIndex = (pageIndex - 1) * pageSize;
		return orderTableDao.getOrdertableByPage(pageIndex, pageSize);

	}
	
	public List<Ordertable> getOrdertableByName( String name,int pageIndex, int pageSize){
		name='%'+name+'%';
		List<Ordertable> list=orderTableDao.getOrdertableByName( name,pageIndex, pageSize);
		
		return list;
	}
}
